#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
    int a = 0;
    scanf("%d", &a);
    int i = a / 1000;
    int j = a / 100 % 10;
    int n = a / 10 % 10;
    int m = a % 10;
    printf("%d%d%d%d", m, n, j, i);
    return 0;
}